package com.liujun.microserver.auth2.authserver.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;

/**
 * 进行auth2的授权服务器配制，此作为单独的授权服务器
 * 
 * @author liujun
 * @date 2018/06/30
 */
@Configuration
@EnableAuthorizationServer
public class Oauth2AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {

	@Override
	public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
		// 使用内存模式
		clients.inMemory()
				// 客户连接用户名
				.withClient("client")
				// 连接的密码
				.secret("abc")
				// 使用的模式,明确	指出，使用授权码模式
				.authorizedGrantTypes("authorization_code")
				// 授权范围,app
				.scopes("app");

	}

}
